%Latex version needed
\NeedsTeXFormat{LaTeX2e}

%Required packages

%Styles
\newcommand{\ps@chapterpage}{
   				\renewcommand{\@oddhead}{\@empty}
   				\renewcommand{\@evenhead}{\@empty}
   				\renewcommand{\@oddfoot}{\OS@footerline{\hfill \large \thepage}}     
	    			\renewcommand{\@evenfoot}{\OS@footerline{\hfill \large \thepage}}     
	    			}

%Name of the package provided
\ProvidesPackage{os3style}[2005/05/26]

%Page Parameters
\voffset=-.5in
\headheight=20pt

%Section numeration limit
\setcounter{secnumdepth}{0}

%Chapter Head 
\let\OS@chaptertitle\relax
\renewcommand{\@makechapterhead}[1]{\def\OS@chaptertitle{#1}
					\thispagestyle{chapterpage}
					\vbox{
					\begin{flushright}
						\huge\bf{\MakeUppercase{\textsf{\chaptername \ \thechapter}}} 
						\vskip.3\normalbaselineskip 
						\hrule\hfil 
						\vskip.1\normalbaselineskip \textsf{#1}
					\end{flushright}}
					\vskip10pt
					}

%Section Head
\let\OS@sectiontitle\relax
\def\sectionmark#1{\markright {\MakeUppercase{\ifnum \c@secnumdepth >\z@\thesection. \ \fi\textsf{#1}}}
			\def\OS@sectiontitle{#1}}
					    
													 
%Footers line
%\def\OS@footerline#1{\vbox{\hrule\hfill \vskip1pt \hfill #1}}
\def\footwidth{\linewidth}
\def\footrulewidth{1pt}
\def\footruleskip{.3\normalbaselineskip}
\def\OS@footerline#1{\vbox{\hrule\@width\footwidth\@height\footrulewidth\vskip\footruleskip \vskip1pt #1}}

%Headers
\let\@oddhead\@empty
\let\@evenhead\@empty

%Footers
\def\@evenfoot{\if\OS@chaptertitle\@empty\else\OS@footerline{\bf \large \textsf{\thepage\, $|$\, \@chapapp \ \thechapter: \,\OS@chaptertitle}}\fi}
\def\@oddfoot{\OS@footerline{\hfill\bf \large \textsf{\OS@sectiontitle}\, $|$\, \large \textsf{\thepage}}}

%Title Page
\let\OS@subtitle\relax
\newcommand\OSsubtitle[1]{\def\OS@subtitle{#1}}
\renewcommand\maketitle{\begin{titlepage}
			\null
			\begin{flushright}
			\if\OS@subtitle\@empty\else{{\bf\Large\textsf{\OS@subtitle}} \vskip.4\normalbaselineskip}\fi
			\hrule\@width\linewidth\@height\footrulewidth\vskip.4\normalbaselineskip
			{\bf\Huge\textsf{\@title}}
			\vskip .6\textheight
			{\bf\it\Large\textsf{\@author}}
			\end{flushright}
			\end{titlepage}
			}


%\openout4prova.os3
%\write4{Vertical offset: \the\voffset}
%\write4{Chapter name: \OS@chaptertitle}
%\closeout4
%Process the options
\ProcessOptions\relax
